package l2hc.gameserver.handler.voicecommands.impl;

import l2hc.gameserver.handler.voicecommands.IVoicedCommandHandler;
import l2hc.gameserver.model.Player;
import l2hc.gameserver.model.Skill;
import l2hc.gameserver.network.serverpackets.Say2;
import l2hc.gameserver.network.serverpackets.components.ChatType;
import l2hc.gameserver.scripts.Functions;
import l2hc.gameserver.tables.SkillTable;

public class SkillUse extends Functions
  implements IVoicedCommandHandler
{
  private String[] _commandList = { "useskill" };

  public boolean useVoicedCommand(String command, Player activeChar, String args)
  {
    int skills = Integer.parseInt(args);

    Skill skill = SkillTable.getInstance().getInfo(skills, activeChar.getSkillLevel(Integer.valueOf(skills)));

    String sk = "/useskill " + skill.getName();
    Say2 cs = new Say2(activeChar.getObjectId(), ChatType.ALL, activeChar.getName(), sk);

    activeChar.setMacroSkill(skill);
    activeChar.sendPacket(cs);

    return true;
  }

  public String[] getVoicedCommandList()
  {
    return this._commandList;
  }
}
